<template>
  <div class="risk">
    <eagle-page-list
      :controller="controller"
      :queryParams="queryParams"
      @bindData="bindData"
      :conditions="conditions"
      ref="eaglePageList"
    >
	 <template #list>
      <div
        class="br-8"
        style="margin-top: 10px; position: relative; overflow: hidden"
        v-for="(item, index) in list"
        :key="index"
      >
        <eagle-card :title="item.ResName" @click="handleClick(item)">
          <template #thumb>
            <van-image
              class="image-box-shadow"
              style="vertical-align: middle"
              width="60px"
              height="60px"
              :src="
                item.Cover == null
                  ? require('@/assets/Images/AppIcon/icon_cou_default.jpg')
                  : item.Cover.indexOf('http') > -1
                  ? item.Cover
                  : baseUrl + item.Cover
              "
            />
          </template>
          <template #desc>
            <div class="text-ellipsis mb-10">
              简介：{{ item.Introduce || "暂无描述" }}
            </div>
            <div class="mb-10">
              <eagle-image
                style="vertical-align: middle"
                width="16"
                height="16"
                :src="require('@/assets/Images/AppIcon/icon_list_post.png')"
              />
              {{ item.CreateChnName }}
            </div>
            <div class="card-bottom">
              <div>
                <eagle-image
                  style="vertical-align: middle"
                  width="16"
                  height="16"
                  :src="require('@/assets/Images/AppIcon/icon_calendar.png')"
                />
                {{ item.CreateDate }}
              </div>
              <div>
                <eagle-image
                  style="vertical-align: middle"
                  width="13"
                  height="9"
                  :src="require('@/assets/Images/AppIcon/icon_ask_view.png')"
                />
                {{ item.ViewCnt }}
              </div>
              <div>
                <eagle-image
                  style="vertical-align: middle; margin-left: 5px"
                  width="11"
                  height="10"
                  :src="
                    item.IsCollected
                      ? require('@/assets/Images/AppIcon/icon_heart_on.png')
                      : require('@/assets/Images/AppIcon/icon_heart_off.png')
                  "
                />
                {{ item.CollectCnt }}
              </div>
            </div>
          </template>
        </eagle-card>
        <eagle-tag class="tags" type="primary">{{
          item.AttExt.slice(1, item.AttExt.length).toUpperCase()
        }}</eagle-tag>
      </div>
	</template>
    </eagle-page-list>
  </div>
</template>

<script>
export default {
  data() {
    return {
      baseUrl: process.env.VUE_APP_BASE_API,
      list: [],
      conditions: {},
      controller: "/TrainRes",
      queryParams: {
        dataType: "MyCollect",
      },
    };
  },
  created() {},
  methods: {
    bindData(data) {
      this.list = [];
      if (data) {
        this.list = data;
      }
    },
    // 设备详情
    handleClick(item) {
      if (item.Type != 4) {
        this.$router.push({
          path: "/Train/WareDetail",
          query: { id: item.ID, sid: item.SID, stype: item.SType },
        });
      } else {
        this.$router.push({
          path: "/Train/CourseDetail",
          query: { id: item.ID },
        });
      }
    },
  },
};
</script>
<style lang="less" scoped>
.image-box-shadow {
  overflow: hidden;
  border-radius: 5px;
}
</style>
<style lang="less">
.risk {
  height: 100vh;
}
.all_dep {
  background-color: #ffffff;
}
// .van-cell {
// 	padding: 10px 0;
// }
.warn_item {
  /*margin-bottom: 10px;*/
  padding: 10px 0 10px 10px;
  border-radius: 5px;
  position: relative;
}
.warn_header {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-bottom: 10px;
  .warn_tag {
    position: absolute;
    right: 0;
    top: 0;
    border-radius: 26.64rem 0 0 26.64rem;
  }
}
.dep_sort {
  display: flex;
  align-items: center;
  margin-bottom: 5px;
  img {
    height: 15px;
    width: 15px;
    margin-right: 5px;
  }
}
.dep_btm {
  display: flex;
  justify-content: flex-end;
  .btm_item {
    display: flex;
    align-items: center;
    img {
      height: 15px;
      width: 15px;
      margin-right: 5px;
    }
  }
}

.tags {
  position: absolute;
  right: 0;
  top: 10px;
  border-radius: 26.64rem 0 0 26.64rem;
}
.card-bottom {
  display: flex;
  justify-content: space-between;
}

.van-card__thumb {
  width: 70px;
}
</style>
